﻿//===================================================================================
// Copyright (c) Ryan Garrett.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===================================================================================

using System;
using System.Collections.Generic;
using Caffeine.Core.Test.TestModel;

namespace Caffeine.Core.Test.TestModel
{
    public class ModelForToStringTesting : ModelBase
    {
        private readonly ModelProperty<EnumForTesting> _enumProperty;
        private readonly ModelProperty<Nullable<EnumForTesting>> _nullableEnumProperty;
        private readonly ModelProperty<Nullable<Int32>> _nullableInt32Property;
        private readonly ModelProperty<String> _stringProperty;
        private readonly ModelProperty<Object> _objectProperty;
        private readonly ModelProperty<Double> _doubleProperty;
        private readonly ModelProperty<ModelForToStringTesting> _viewModelProperty;
        private readonly ModelProperty<String> _computedProperty;

        public ModelForToStringTesting()
        {
            _enumProperty = RegisterProperty<EnumForTesting>("EnumProperty");
            _nullableEnumProperty = RegisterProperty<Nullable<EnumForTesting>>("NullableEnumProperty");
            _nullableInt32Property = RegisterProperty<Nullable<Int32>>("NullableInt32Property");
            _stringProperty = RegisterProperty<String>("StringProperty");
            _objectProperty = RegisterProperty<Object>("ObjectProperty");
            _doubleProperty = RegisterProperty<Double>("DoubleProperty");
            _viewModelProperty = RegisterProperty<ModelForToStringTesting>("ModelProperty");
            _computedProperty = RegisterComputedProperty<String>("ComputedProperty", ComputeStringValue, StringProperty);
        }

        public ModelProperty<EnumForTesting> EnumProperty
        {
            get { return _enumProperty; }
        }

        public ModelProperty<Nullable<EnumForTesting>> NullableEnumProperty
        {
            get { return _nullableEnumProperty; }
        }

        public ModelProperty<Nullable<Int32>> NullableInt32Property
        {
            get { return _nullableInt32Property; }
        }

        public ModelProperty<String> StringProperty
        {
            get { return _stringProperty; }
        }

        public ModelProperty<Object> ObjectProperty
        {
            get { return _objectProperty; }
        }

        public ModelProperty<Double> DoubleProperty
        {
            get { return _doubleProperty; }
        }

        public ModelProperty<ModelForToStringTesting> ModelProperty
        {
            get { return _viewModelProperty; }
        }

        public ModelProperty<String> ComputedProperty
        {
            get { return _computedProperty; }
        } 

        private String ComputeStringValue(IEnumerable<ModelProperty<String>> stringProperties, String currentValue)
        {
            return currentValue;
        }
    }
}
